/**
 * @param {number[][]} matrix
 * @return {void} Do not return anything, modify matrix in-place instead.
 */

var setZeroes = function (matrix) {
    let row = matrix.length
    let col = matrix[0].length
    let rec = []
    for (let i = 0; i < row; i++) {
        for (let j = 0; j < col; j++) {
            // 寻找为0的数 并记录
            if (matrix[i][j] === 0) {
                rec.push([i, j])
            }
        }
    }
    // 将0所在的行与列都变为0
    for (let i = 0; i < rec.length; i++) {
        let wborder = 0
        let cborder = 0
        // 行
        while (wborder < row) {
            matrix[wborder][rec[i][1]] = 0
            wborder++
        }
        // 列
        while (cborder < col) {
            matrix[rec[i][0]][cborder] = 0
            cborder++
        }
    }
    return matrix
};